PUBLIC = ../../public
SRC = src
BIN = ../../bin
CFLAGS = -Wall -pedantic -ansi -Werror
CC = gcc
LIB_TOOL = ar
LIB_FLAGS = -r -s
COMPILE_FLAG = -c

all: release 

debug: CFLAGS+=-g 
debug: BIN=../../bin/debug
debug: $(BIN)/libPQ.a clean
	@echo "**********************************************************"
	@echo "*							*"
	@echo "*		 LIBRARY CREATED			*"
	@echo "*							*"
	@echo "**********************************************************"

release: CFLAGS+=-O3 -DNDEBUG
release: BIN=../../bin/release
release: $(BIN)/libPQ.a clean
	@echo "**********************************************************"
	@echo "*							*"
	@echo "*		 LIBRARY CREATED			*"
	@echo "*							*"
	@echo "**********************************************************"

$(BIN)/libPQ.a: PQ.o 
	@echo "**********************************************************"
	@echo "*							*"
	@echo "*		CREATING LIBRARY			*"
	@echo "*							*"
	@echo "**********************************************************"
	$(LIB_TOOL) $(LIB_FLAGS) $(BIN)/libPQ.a PQ.o 

PQ.o: $(PUBLIC)/PQ.h PQ.c
	$(CC) $(COMPILE_FLAG) $(CFLAGS) -I$(PUBLIC) PQ.c -o PQ.o

clean: 
	rm *.o
